package com.itheima.app.controller;

import com.itheima.app.manager.TestSoulManager;
import com.itheima.vo.AnswersVo;
import com.itheima.vo.ReportVo;
import com.itheima.vo.TopicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 测灵魂模块
 */
@RestController
public class TestSoulController {

    @Autowired
    private TestSoulManager testSoulManager;

    // 查询问卷
    @GetMapping("/testSoul")
    public List<TopicVo> queryTestSoul() {
        return testSoulManager.queryTestSoul();
    }

    // 提交问卷
    @PostMapping("/testSoul")
    public Long saveTestSoul(@RequestBody AnswersVo answersVo) {
        return testSoulManager.saveTestSoul(answersVo);
    }

    // 查询报告
    @GetMapping("/testSoul/{id}")
    public ReportVo queryReport(@PathVariable Long id) {
        return testSoulManager.queryReport(id);
    }
}
